package xinxin.com.CommandPatternBasic.Invoker;

import xinxin.com.CommandPatternBasic.Command.Command;

import java.util.ArrayList;
import java.util.List;

public class Invoker {
    private List<Command> commands = new ArrayList<Command>();

    public void addCommand(Command command) {
        commands.add(command);
    }

    public void removeCommand(Command command) {
        commands.remove(command);
    }

    public void ExcuteCommand() {
        for (Command command:commands) {
            command.Execute();
        }
    }
}
